function formatSizeBytes(sizeBytes) {
    if (sizeBytes < 0) {
        throw new Error("Size must be a non-negative number.");
    }

    if (sizeBytes === 0) {
        return "0.00 B";
    }

    const units = ["B", 'KB', 'MB', 'GB', 'TB', 'PB'];
    console.log(sizeBytes)
    const index = Math.floor(Math.log(sizeBytes) / Math.log(1024));
    const divisor = Math.pow(1024, index);

    const humanReadable = (sizeBytes / divisor).toFixed(2);
    return `${humanReadable} ${units[index]}`;
}

// Format Occupation string
// For example:
// 1.5kB / 100kB (Same unit)
// 150kB / 200GB (Not same unit)
function formatSizeOccupationBytes(sizeBytes, totalBytes) {
    const formattedSize = formatSizeBytes(sizeBytes);
    const formattedTotal = formatSizeBytes(totalBytes);
    const ratio = (sizeBytes / totalBytes * 100.0).toFixed(2);
    return {
        percentage: sizeBytes / totalBytes * 100,
        text: `${formattedSize} / ${formattedTotal} (${ratio}%)`
    };

}